//------------------------------------------------------------------------------
// <copyright file="WMIHelper.cs" company="Damian Antonowicz">
//       copyright © 2010 Damian Antonowicz
// </copyright>
// <author>Damian Antonowicz</author>
// <email>poczta@damianantonowicz.pl</email>
//------------------------------------------------------------------------------

using System.Globalization;
using System.Management;

namespace DAnton.Utilities.Helpers
{
    public static class WMIHelper
    {
        public static CultureInfo GetOperatingSystemCultureInfo()
        {
            string query = "SELECT Locale FROM Win32_OperatingSystem";
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
            ManagementObjectCollection queryCollection = searcher.Get();
            
            int LCID = 0;

            foreach (ManagementObject m in queryCollection)
                LCID = int.Parse(m["Locale"].ToString(), NumberStyles.AllowHexSpecifier);

            return new CultureInfo(LCID);
        }
    }
}
